package
{
	public interface IYouTubePlayer
	{
		/**
		 * copied from: 
		 * http://code.google.com/intl/pl/apis/youtube/flash_api_reference.html
		 * 
		 * Loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until playVideo() or seekTo() is called.
		 * The required videoId parameter specifies the YouTube Video ID of the video to be played. In YouTube Data API video feeds, the <yt:videoId> tag specifies the ID.
    	 * The optional startSeconds parameter accepts a float/integer and specifies the time from which the video should start playing when playVideo() is called. If you specify a startSeconds value and then call seekTo(), then the player plays from the time specified in the seekTo() call. When the video is cued and ready to play, the player will broadcast a video cued event (5).
    	 * The optional suggestedQuality parameter specifies the suggested playback quality for the video. Please see the definition of the setPlaybackQuality function for more information about playback quality.
		 */		
		function cueVideoById(videoId:String, startSeconds:Number = NaN, suggestedQuality:String = null):void
		
		/**
		 * Loads and plays the specified video.
	     * The required videoId parameter specifies the YouTube Video ID of the video to be played. In YouTube Data API video feeds, the <yt:videoId> tag specifies the ID.
    	 * The optional startSeconds parameter accepts a float/integer. If it is specified, then the video will start from the closest keyframe to the specified time.
    	 * The optional suggestedQuality parameter specifies the suggested playback quality for the video. Please see the definition of the setPlaybackQuality function for more information about playback quality.
		 */
		function loadVideoById(videoId:String, startSeconds:Number = NaN, suggestedQuality:String = null):void;
		
		/**
		 * Loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until playVideo() or seekTo() is called.
	     * The mediaContentUrl must be a fully qualified YouTube player URL in the format http://www.youtube.com/v/VIDEO_ID. In YouTube Data API video feeds, the url attribute of the <media:content> tag contains a fully qualified player URL when the tag's format attribute has a value of 5.
    	 * startSeconds accepts a float/integer and specifies the time from which the video should start playing when playVideo() is called. If you specify startSeconds and then call seekTo(), then the player plays from the time specified in the seekTo() call. When the video is cued and ready to play, the player will broadcast a video cued event (5).
		 */
		function cueVideoByUrl(mediaContentUrl:String, startSeconds:Number = NaN):void;
		
		/**
		 * This function, which loads and plays the specified video, has not yet been implemented for the ActionScript 3.0 Player API.
	     * The mediaContentUrl must be a fully qualified YouTube player URL in the format http://www.youtube.com/v/VIDEO_ID. In YouTube Data API video feeds, the url attribute of the <media:content> tag contains a fully qualified player URL when the tag's format attribute has a value of 5.
    	 * startSeconds accepts a float/integer and specifies the time from which the video should start playing. If startSeconds (number can be a float) is specified, the video will start from the closest keyframe to the specified time.
    	 */
		function loadVideoByUrl(mediaContentUrl:String, startSeconds:Number = NaN):void;
		
		/**
		 * Plays the currently cued/loaded video.
		 */
		function playVideo():void;

		/**
		 * Pauses the currently playing video.
		 */
		function pauseVideo():void;
		
		/**
		 * Stops the current video. This function also cancels the loading of the video.
		 */		
		function stopVideo():void;
		
		/** 
		 * Seeks to the specified time of the video in seconds. The seekTo() function will look for the closest keyframe before the seconds specified. This means that sometimes the play head may seek to just before the requested time, usually no more than ~2 seconds.
		 * The allowSeekAhead parameter determines whether or not the player will make a new request to the server if seconds is beyond the currently loaded video data.
		 */ 		
		function seekTo(seconds:Number, allowSeekAhead:Boolean):void;
		
		/**
		 * Mutes the player.
		 */			
		function mute():void;
		
		/**
		 * Unmutes the player.
		 */			
		function unMute():void;

		/**
		 * Returns true if the player is muted, false if not.
		 */			
		function isMuted():Boolean;

		/**
		 * Sets the volume. Accepts an integer between 0 and 100.
		 */			
		function setVolume(volume:Number):void;
		
		/**
		 * Returns the player's current volume, an integer between 0 and 100. Note that getVolume() will return the volume even if the player is muted.
		 */		
		function getVolume():Number;
		
		/**
		 * Sets the size in pixels of the player. This method should be used instead of setting the width and height properties of the MovieClip.
		 * Note that this method does not constrain the proportions of the video player, so you will need to maintain a 4:3 aspect ratio. 
		 * The default size of the chromeless SWF when loaded into another SWF is 320px by 240px and the default size of the embedded player SWF is 480px by 385px.
		 */		
		function setSize(width:Number, height:Number):void;
		
		/**
		 * Returns the number of bytes loaded for the current video.
		 */		
		function getVideoBytesLoaded():Number;
		
		/**
		 * Returns the size in bytes of the currently loaded/playing video.
		 */		
		function getVideoBytesTotal():Number;
		
		/**
		 * Returns the number of bytes the video file started loading from. Example scenario: the user seeks ahead to a point that hasn't loaded yet,
		 * and the player makes a new request to play a segment of the video that hasn't loaded yet.
		 */		
		function getVideoStartBytes():Number;
		
		/**
		 * Returns the state of the player. Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
		 */		
		function getPlayerState():Number;
		
		/**
		 * Returns the elapsed time in seconds since the video started playing.
		 */		
		function getCurrentTime():Number
		
		/**
		 * This function retrieves the actual video quality of the current video. It returns undefined if there is no current video. 
		 * Possible return values are hd720, large, medium and small.
		 */		
		function getPlaybackQuality():String;
		
		/**
		 * This function sets the suggested video quality for the current video. 
		 * The function causes the video to reload at its current position in the new quality. 
		 * If the playback quality does change, it will only change for the video being played.
		 * 
		 * Calling this function does not guarantee that the playback quality will actually change. 
		 * If the playback quality does change, it will only change for the video being played. 
		 * At that time, the onPlaybackQualityChange event will fire, 
		 * and your code should respond to the event rather than the fact that it called the setPlaybackQuality function.
		 * 
		 * The suggestedQuality parameter value can be small, medium, large, hd720 or default. 
		 * Setting the parameter value to default instructs YouTube to select the most appropriate playback quality, 
		 * which will vary for different users, videos, systems and other playback conditions.
		 * 
		 * When you suggest a playback quality for a video, the suggested quality will only be in effect for 
		 * that video. You should select a playback quality that corresponds to the size of your video player. 
		 * For example, if your page displays a 640px by 360px video player, a medium quality video will actually look better than a large quality video. The following list shows recommended playback quality levels for different player sizes:
		 * - Quality level small: Player resolution less than 640px by 360px.
    	 * - Quality level medium: Minimum player resolution of 640px by 360px.
		 * - Quality level large: Minimum player resolution of 854px by 480px.
    	 * - Quality level hd720: Minimum player resolution of 1280px by 720px.
    	 * - Quality level default: YouTube selects the appropriate playback quality. This setting effectively reverts the quality level to the default state and nullifies any previous efforts to set playback quality using the cueVideoById, loadVideoById or setPlaybackQuality functions.
  		 * If you call the setPlaybackQuality function with a suggestedQuality level that is not available for the video, 
  		 * then the quality will be set to the next lowest level that is available. 
  		 * For example, if you request a quality level of large, and that is unavailable, 
  		 * then the playback quality will be set to medium (as long as that quality level is available).
		 * In addition, setting suggestedQuality to a value that is not a recognized quality level
		 * is equivalent to setting suggestedQuality to default.
		 */		
		function setPlaybackQuality(suggestedQuality:String):void;
		
		/**
		 * This function returns the set of quality formats in which the current video is available. 
		 * You could use this function to determine whether the video is available in a higher quality
		 * than the user is viewing, and your player could display a button or other element to let the user adjust the quality.
		 * The function returns an array of strings ordered from highest to lowest quality. 
		 * Possible array element values are hd720, large, medium and small. This function returns an empty array
		 * if there is no current video.
		 * Your client should not automatically switch to use the highest (or lowest) quality video or to any
		 * unknown format name. YouTube could expand the list of quality levels to include formats that may not
		 * be appropriate in your player context. Similarly, YouTube could remove quality options that would be
		 * detrimental to the user experience. By ensuring that your client only switches to known, available formats,
		 * you can ensure that your client's performance will not be affected by either the introduction of new quality
		 * levels or the removal of quality levels that are not appropriate for your player context.
		 */		
		function getAvailableQualityLevels():Array;
		
		/**
		 * Returns the duration in seconds of the currently playing video. Note that getDuration() will return 0 until the video's metadata is loaded,
		 * which normally happens just after the video starts playing.
		 */		
		function getDuration():Number;
		
		/**
		 * Returns the YouTube.com URL for the currently loaded/playing video.
		 */		
		function getVideoUrl():String;
		
		/**
		 * Returns the embed code for the currently loaded/playing video.
		 */		
		function getVideoEmbedCode():String;
		
		/**
		 * Adds a listener function for the specified event. 
		 * The Events section below identifies the different events that the player might fire. The listener is a reference to the function that will execute when the specified event fires.
		 */		
		function addEventListener(event:String, listener:Function):void;
		
		/**
		 * This function, which has not yet been implemented for the AS3 Player API, destroys the player instance.
		 * This method should be called before unloading the player SWF from your parent SWF.
		 * Important: You should always call player.destroy() to unload a YouTube player. 
		 * This function will close the NetStream object and stop additional videos from downloading after 
		 * the player has been unloaded. If your code contains additional references to the player SWF,
		 * you also need to destroy those references separately when you unload the player.
		 */		
		function destroy():void;
		
	}
}